package com.dongjiantong.sys;/**
 * Created by cao on 2017/11/28.
 */



import com.dongjiantong.common.redis.RedisUtil;
import com.dongjiantong.sys.model.SysArea;
import com.dongjiantong.sys.service.DicUnitService;
import com.dongjiantong.sys.service.SysAreaService;
import com.dongjiantong.sys.serviceImpl.DicUnitServiceImpl;
import com.dongjiantong.sys.serviceImpl.SysAreaServiceImpl;
import com.google.common.collect.Lists;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;

import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

/**
 * @author cao
 * @create 2017-11-28 上午11:43
 **/
@SpringBootApplication
@MapperScan(basePackages = "com.dongjiantong.sys.mapper")
public class RedisMain {

    public static void main(String[] args) {

        List<SysArea> list = Lists.newArrayList();
        for(int i=1;i<10;i++)
        {
            SysArea sysArea = new SysArea();

            sysArea.setArea_code("32"+i);
            sysArea.setArea_name("江苏省"+i);

            try {
                RedisUtil.setObject("areacc"+i, sysArea);

                SysArea sysArea2 = RedisUtil.getObject("areacc"+i, SysArea.class);

                System.out.println(sysArea2.getArea_name());
            } catch (Exception e) {
                e.printStackTrace();
            }

            list.add(sysArea);
        }



        RedisUtil.setList("listcc",list);

        List  list1 = RedisUtil.getList("listcc");
        System.out.println(list1.toString());

        String mapkey="tokenWeb:fe82aee7Z7f405949Z160bb55821fZ52b0";

        Map<String,Object> map = RedisUtil.getMaps(mapkey);

        System.out.println(map.get("userId"));

    }
}
